package com.s63.ssm.utils;

import com.s63.ssm.config.SpringConfig;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class SpringUtils {
//    private static ApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml");
private static ApplicationContext ctx = new AnnotationConfigApplicationContext(SpringConfig.class);

    public static<T> T getBean(String id) {
        return (T) ctx.getBean(id);
    }

    public static<T> T getBean(Class<T> clz) {
        return ctx.getBean(clz);
    }
}
